package util;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.xpath.XPath;

public class XMLParse {
	public static void main(String[] args) throws JDOMException, IOException{
		
		 SAXBuilder builder = new SAXBuilder();
	     Document doc = builder.build("samlResponse.xml");

			Element root=doc.getRootElement(); 
			
			
			XPath xpath = XPath.newInstance("//default:NameID");
			xpath.addNamespace("default", "urn:oasis:names:tc:SAML:2.0:assertion");
			
			
		    List list = xpath.selectNodes(root);

		    Iterator iter = list.iterator();
		     while (iter.hasNext()) {
		       Element item = (Element) iter.next();
		       System.err.println(item.getText());
		     }
			//return value;
	}

}
